package StringDictionary;

import java.util.Observable;

import smarties.SmartInfoManager;
import smarties.SmartNode;

/**
 * Classe permettant de lancer la recherche et de notifier les observeurs
 * lorsque celle-ci est finie.
 * 
 * @author buthane
 */
public class SearchRunnable extends Observable implements Runnable
{

	protected SearchResult<SmartNode>	searchResult;
	protected String					textToSearch;

	public SearchRunnable(String textToSearch,
			SearchResult<SmartNode> searchResult)
	{
		this.textToSearch = textToSearch;
		this.searchResult = searchResult;
	}

	protected SearchRunnable()
	{

	}

	public SearchRunnable(String textToSearch)
	{
		this.textToSearch = textToSearch;
		this.searchResult = new SearchResult<SmartNode>();
	}

	public void run()
	{
		SmartInfoManager.getInstance().findText(this.textToSearch,
				this.searchResult);

		this.setChanged();
		this.notifyObservers(this.searchResult);
	}

}
